#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int Count(int x)
{
    int flag = 1, count = 1, i = 3;
    if (x < 7)
        return 1;
    else
    {
        x -= 1;
        while (flag)
        {
            x -= 2 * i;
            if (x >= 0)
            {
                flag = 1;
                count++;
            }
            else
                flag = 0;
            i += 2;
        }
    }
    return count;
}

int Printc(int count,char c)
{
    int i = 0, j = 0, k = 0, l = 0, n = 3;
    int count1 = 0;
    l = count * 2 - 1;
    l = (l - 3) / 2;
    k = count;
    for (i = 0; i < count; i++)
    {
        for (j = 0; j < i; j++)
            printf(" ");
        for (j = 0; j < 2 * k - 1; j++)
        {
            printf("%c", c);
            count1++;
        }
        printf("\n");
        k--;
    }
    for (i = 0; i < count - 1; i++)
    {
        for (j = 0; j < l; j++)
            printf(" ");
        for (j = 0; j < n; j++)
        {
            printf("%c", c);
            count1++;
        }
        printf("\n");
        l -= 1;
        n += 2;
    }
    return count1;
}

int main()
{
    int x = 0, y = 0;
    char c = 'a';
    scanf("%d %c", &x, &c);
    y = Count(x);
    int F=Printc(y,c);
    printf("%d\n", x-F);
    return 0;
}

